---
title: gluestack-ui Slider Alert | Installation, Usage, and API

description: Alerts are used to communicate the status of a system, feature, or page. They indicate a specific state that may require attention from the user.

pageTitle: Alert

pageDescription: Alerts are used to communicate the status of a system, feature, or page. They indicate a specific state that may require attention from the user.

showHeader: true
---

import { Meta } from '@storybook/addon-docs';

<Meta title="ui/Components/Feedback/Alert" />

import {
  Alert,
  AlertIcon,
  AlertText,
  CheckCircleIcon,
  CloseCircleIcon,
  Icon,
} from './Alert';
import { BellIcon, AlertCircleIcon, Center, VStack, InfoIcon } from './Alert';
import { HStack } from './Alert';
import { transformedCode } from '../../../utils';
import {
  AppProvider,
  CodePreview,
  Table,
  InlineCode,
  TableContainer,
} from '@gluestack/design-system';

import Wrapper from '../../Wrapper';

This is an illustration of a **Themed Alert** component with default configuration.

<AppProvider>
  <CodePreview
    _rendererWrapper={{ px: '$2.5' }}
    showComponentRenderer={true}
    showArgsController={true}
    metaData={{
      code: `
        <Alert mx='$2.5'  {...props}>
          <AlertIcon as={InfoIcon} mr="$3"  />
          <AlertText>
            We have updated our terms of service. Please review and accept to continue using our service.
          </AlertText>
        </Alert>
      `,
      transformCode: (code) => {
        return transformedCode(code);
      },
      scope: {
        Alert,
        AlertIcon,
        AlertText,
        Wrapper,
        InfoIcon,
      },
      argsType: {
        action: {
          control: 'select',
          options: ['success', 'info', 'error', 'warning', 'muted'],
          default: 'info',
        },
        variant: {
          control: 'select',
          options: ['accent', 'solid', 'outline'],
          default: 'solid',
        },
      },
    }}
  />
</AppProvider>

<br />

## API Reference

### Import

To use this component in your project, include the following import statement in your file.

```jsx
import { Alert, AlertIcon, AlertText } from '@gluestack-ui/themed';
```

### Anatomy

The structure provided below can help you identify and understand a Alert component's various parts.

```jsx
export default () => (
  <Alert>
    <AlertIcon />
    <AlertText />
  </Alert>
);
```

### Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

#### Alert

Contains all alert related layout style props and actions. It inherits all the properties of React Native's [View](https://reactnative.dev/docs/pressable) component.

**Descendants Styling Props**
Props to style child components.

<AppProvider>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Sx Prop</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Description</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>_text</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`Prop to style AlertText Component`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>_icon</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`Prop to style AlertIcon Component`}</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</AppProvider>

#### AlertIcon

It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component.

#### AlertText

Contains all spinner related layout style props and actions. It inherits all the properties of React Native's [Text](https://reactnative.dev/docs/text) component.

## Themed

The themed version of the component is a pre-styled version of the component, which allows you to quickly integrate the component into your project. The component's design and functionality are fully defined, allowing you to focus on the more important aspects of your project. To know more about Themed Library please visit this [link](https://gluestack.io/ui/docs/core-concepts/themed-library).

### Props

Alert component is created using View component from react-native. It extends all the props supported by [React Native View](https://reactnative.dev/docs/view#props), [utility props](/ui/docs/styling/utility-and-sx-props) and the props mentioned below.

#### Alert

<AppProvider>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Name</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Value</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Default</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>action</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>error | warning | success | info | muted</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>info</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>variant</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>solid | outline | accent</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>solid</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</AppProvider>

### Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

#### Alert with Heading

An example of an alert component with a heading, which further contains another alert component for displaying supplementary information.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
        <Alert action='success'>
          <AlertIcon as={CheckCircleIcon} size="xl"  mr="$3" />
          <VStack space='xs'>
            <AlertText fontWeight ='$bold'>
              Congratulations!
            </AlertText >
            <AlertText >
              Thank you for your submission. You will receive a confirmation email shortly.
            </AlertText>
          </VStack>
        </Alert>
      `,
      transformCode: (code) => {
        return transformedCode(code);
      },
      scope: {
        Alert,
        AlertIcon,
        AlertText,
        Wrapper,
        CheckCircleIcon,
        VStack,
        Icon,
      },
      argsType: {},
    }}
/>

</AppProvider>

## Unstyled

All the components in `gluestack-ui` are unstyled by default. To customize your UI using the extendedTheme, please refer to this [link](https://gluestack.io/ui/docs/theme-configuration/customizing-theme/eject-library). The import names of components serve as keys to customize each component.

<!--

### Advanced

We provide in-depth information on how to customize and extend the component's functionality to meet your needs. Below, we describe how to modify the component to suit your requirements.

### Customizing the Alert

We have a function called `createAlert` which can be used to create a custom alert component. This function takes in a configuration object which contains the styled components that you want to use for the Alert You can refer [gluestack.io/style](/style/docs/getting-started/styled) on how to use styled components.

#### Usage

Default styling of all these components can be found in the `components/core/alert` file. For reference, you can view the [source code](https://github.com/gluestack/gluestack-ui/blob/main/packages/themed/src/components/Alert) of the styled `Alert` components.

```jsx
// import the styles
import { Root, Text, Icon } from '../components/core/alert/styled-components';

// Understanding the API
const Alert: any = Root;
AlertIcon = Icon;
AlertText = Text;

// Using the alert component
export default () => (
  <Alert>
    <AlertIcon />
    <AlertText />
  </Alert>
);
```
-->

## Spec Doc

Explore the comprehensive details of the Alert in this document, including its implementation details, checklist, and potential future additions. Dive into the thought process behind the component and gain insights into its development journey.

<iframe
  style={{
    borderRadius: '8px',
    border: ' 1px solid rgba(0, 0, 0, 0.1)',
    aspectRatio: 736 / 585,
  }}
  src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Fproto%2FNcXOxqKbdnGsLQNex3H76u%2F%25C2%25A0%25F0%259F%2593%259Agluestack-UI-handbook%3Ftype%3Ddesign%26node-id%3D6300-43142%26t%3DZPsVa5mi34R2dR7W-1%26scaling%3Dscale-down%26page-id%3D6300%253A41240%26starting-point-node-id%3D6300%253A43142%26mode%3Ddesign"
  allowFullScreen
/>
